@extends('backstage.layout.master')
@section('title', '公告列表')
@section('content')
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try {
                ace.settings.check('breadcrumbs', 'fixed')
            } catch (e) {
            }
        </script>

        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="backstage/home">主页</a>
            </li>

            <li class="active">
                公告列表
            </li>
        </ul><!-- .breadcrumb -->
    </div>

    <div class="page-content">
        <div class="row">
            <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->
                <div class="page-content">
                    <div class="page-header">
                        <h1>
                            公告列表
                        </h1>
                        <a href="backstage/announcements/add"><button class="btn btn-danger add-btn-danger" style="float: right;">添加</button></a>
                    </div><!-- /.page-header -->

                    <div class="row">
                        <div class="col-xs-12">
                            <!-- PAGE CONTENT BEGINS -->
                            <div class="table-responsive">
                                <table id="sample-table-2" class="table table-striped table-bordered table-hover">
                                    <thead>
                                    <tr>
                                        <th>公告编号</th>
                                        <th>公告内容</th>
                                        <th>开始时间</th>
                                        <th>结束时间</th>
                                        <th>状态</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    @foreach ($announcements as $announcement)
                                        <tr>
                                            <td>{{$announcement->announcement_id}}</td>
                                            <td>{{$announcement->announcement_content}}</td>
                                            <td class="hidden-480">{{date('Y-m-d H:i:s',$announcement->announcement_begin_time)}}</td>
                                            <td class="hidden-480">{{date('Y-m-d H:i:s',$announcement->announcement_end_time)}}</td>
                                            <td>
                                                @if($announcement->announcement_end_time < time())
                                                    <p style="color:red;">已经结束</p>
                                                @elseif($announcement->announcement_end_time >= time() && time() > $announcement->announcement_begin_time)
                                                    <p>正在进行</p>
                                                @else
                                                    <p style="color:blue;">还未开始</p>
                                                @endif
                                            </td>
                                            <td>
                                                <a class="blue" href="backstage/announcements/update/?announcement_id={{$announcement->announcement_id}}">编辑</a>
                                                <a href="backstage/announcements/delete/?announcement_id={{$announcement->announcement_id}}" class="red" onclick="return confirm('确认删除吗？');">删除</a>
                                            </td>
                                        </tr>
                                    @endforeach
                                    </tbody>
                                </table>
                            </div>
                            <div class="row">
                                <div class="col-sm-6">
                                    <div class="dataTables_info" id="sample-table-2_info"></div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="dataTables_paginate paging_bootstrap">
                                        <?php echo $announcements->render(); ?>
                                    </div>
                                </div>
                            </div>
                            <!-- PAGE CONTENT ENDS -->
                        </div><!-- /.col -->
                    </div><!-- /.row -->
                </div><!-- /.page-content -->
            </div>
        </div>
    </div>
@stop
@section('script')
    <script type="text/javascript">

    </script>
@stop